import request from "@/utils/request";

// 添加购物车
export const getaddCart = (goodsId, goodsNum, goodsSkuId) => {
  return request.post("/cart/add", {
    goodsId,
    goodsNum,
    goodsSkuId,
  });
};

// 购物车商品列表
export const getCartList = () => {
  return request.get("/cart/list");
};

// 购物车商品更新
export const upadataGoods = (goodsId, goodsNum, goodsSkuId) => {
  return request.post("/cart/update", {
    goodsId,
    goodsNum,
    goodsSkuId,
  });
};

// 删除购物车商品
export const delCart = (cartIds) => {
  return request.post("/cart/clear", {
    cartIds,
  });
};

// 我的订单
export const getMyOrder = (page, dataType) => {
  return request.get("/order/list", {
    params: {
      page,
      dataType,
    },
  });
};
// 获取个人信息
export const getUserInfoDetail = () => {
  return request.get("/user/info");
};

// 取消支付
export const cancelOrder = (orderId) => {
  return request.post("/order/cancel", {
    orderId,
  });
};
